function GetDevices() {

	var myData = [
			['1', '看板1', "生产线1", "1",'碾磨', "100",'30' , '1','3','28' ,'20','19','正常'],
			['2', '看板2', "生产线2", "2",'打磨', "200",'130', '1','3','128','20','19','正常'],
			['3', '看板3', "生产线3", "3",'抛光', "300",'230', '1','3','228','20','19','正常'],
			['4', '看板4', "生产线4", "4",'锻造', "400",'330', '1','3','328','20','19','正常'],
			['5', '看板5', "生产线5", "5",'组装', "500",'430', '1','3','428','20','19','正常']
		                                         
	];


	var store = new Ext.data.ArrayStore({
				fields : [{
							name : 'id'
						}, {
							name : 'name'
						}, {
							name : 'desc'
						}, {
							name : 'index'
						}, {
							name : 'type'
						}, {
							name : 'total'
						}, {
							name : 'jihua'
						}, {
							name : 'jiezou1'
						}, {
							name : 'jiezou2'
						}, {
							name : 'shiji'
						}, {
							name : 'kedonglv1'
						}, {
							name : 'kedonglv2'
						}, {
							name : 'status'
						}]
			});
			
	store.loadData(myData);
	
	var sm = new Ext.grid.CheckboxSelectionModel();
	var grid = new Ext.grid.GridPanel({
				store : store,
				columns : [sm, {
							id : 'id',
							header : 'id',
							width : 10,
							sortable : true,
							dataIndex : 'id',
							hidden : true
						}, {
							header : '名称',
							width : 100,
							sortable : true,
							dataIndex : 'name'
						}, {
							header : '描述',
							width : 70,
							sortable : true,
							dataIndex : 'desc'
						}, {
							header : '台号',
							width : 70,
							sortable : true,
							dataIndex : 'index'
						}, {
							header : '状态',
							width : 70,
							sortable : true,
							dataIndex : 'status'
						}, {
							header : '产线类型',
							width : 70,
							sortable : true,
							dataIndex : 'type'
						}, {
							header : '总计划数',
							width : 70,
							sortable : true,
							dataIndex : 'total'
						}, {
							header : '当前计划数',
							width : 70,
							sortable : true,
							dataIndex : 'jihua'
						}, {
							header : '节奏1',
							width : 70,
							sortable : true,
							dataIndex : 'jiezou1'
						}, {
							header : '节奏2',
							width : 70,
							sortable : true,
							dataIndex : 'jiezou2'
						}, {
							header : '完成数',
							width : 70,
							sortable : true,
							dataIndex : 'shiji'
						}, {
							header : '可动率1',
							width : 70,
							sortable : true,
							dataIndex : 'kedonglv1'
						}, {
							header : '可动率2',
							width : 70,
							sortable : true,
							dataIndex : 'kedonglv2'
						}],
				sm : sm,
				tbar : [{
				            text:'添加',
				            tooltip : '添加',
				            iconCls: 'add', 
							handler : function() {
								SetDevices(managerReturn);
							}
				        },'-',{
							text : '编辑',
							tooltip : '编辑',
							iconCls : 'modify',
							handler : function() {
								SetDevices(managerReturn);
							}
						}, '-', {
							text : '删除',
							tooltip : '删除',
							iconCls : 'delete',
							ref : '../removeBtn',
							disabled : true,
							handler : function() {
								var s = grid.getSelectionModel().getSelections();
								for (var i = 0; r = s[i]; i++) {
									store.remove(r);
								}
							}
						}, '-', {
							text : '设置',
							tooltip : '设置',
							iconCls : 'set',
							handler : function() {							
								ControlDevices();
							}
						}, '-', {
							text : '刷新',
							tooltip : '刷新',
							iconCls : 'refresh',
							handler : function() {							
								store.loadData(myData);
							}
						}],
			
				stripeRows : true,
				autoExpandColumn : 'id',
				stateful : true,
				stateId : 'devicesgrid'
			});
	grid.getSelectionModel().on('selectionchange', function(sm) {
				grid.removeBtn.setDisabled(sm.getCount() < 1);
			});

	function managerReturn(data){
		var jsondata = Ext.util.JSON.decode(data);
		
	}

	function reflashgriad(page) {
	}
	
	
	
	return grid;
}


function SetDevices(managerReturn){




	var manager_north = {
		xtype: 'fieldset',
		margins:'5 5 5 5',
		layout : 'form',
		region:'center',
		bodyStyle : 'padding:10px;',
		items: [
		{
			xtype: 'textfield',
			name: 'name',
			id  : 'name',
			fieldLabel: '名称',
			anchor: '100%'
		},{
			xtype: 'textarea',
			name: 'depict',
			id  : 'depict',
			fieldLabel: '描述',
			anchor: '100%'
		},{
			xtype: 'textfield',
			name: 'pwd',
			id  : 'pwd',
			fieldLabel: '台号',
			anchor: '100%'
		},{
			xtype: 'textfield',
			name: 'type',
			id  : 'type',
			fieldLabel: '产线类型',
			anchor: '100%'
		}

		]
	};


	
	var managerWindows = new Ext.Window({
				layout : 'border',
				width : 400,
				height : 250,
				title : "添加设备",
				modal : true,
				resizable : true,
				maximizable : true,
				iconCls : 'server',
				items : manager_north,
				plain : true
			});
	managerWindows.addButton({
				text : "确定",
				handler : function() {
				
					managerWindows.close();
				}
			});
	managerWindows.addButton({
				text : '取 消',
				handler : function() {
					managerWindows.close();
				}
			});
	managerWindows.show();


}
	
function ControlDevices(managerReturn){




	var manager_north = {
		xtype: 'fieldset',
		margins:'5 5 5 5',
		layout : 'form',
		region:'center',
		bodyStyle : 'padding:10px;',
		items: [
		{
			xtype: 'textfield',
			name: 'name',
			id  : 'name',
			value: '看板1',
			fieldLabel: '名称',
			readOnly : true,
			style:'color:blue;',
			anchor: '100%'
		},{
			xtype: 'textarea',
			name: 'depict',
			id  : 'depict',
			value: '生产线1',
			fieldLabel: '描述',
			readOnly : true,
			style:'color:blue;',
			anchor: '100%'
		},{
			xtype: 'textfield',
			name: 'pwd',
			id  : 'pwd',
			value: '1',
			fieldLabel: '台号',
			readOnly : true,
			style:'color:blue;',
			anchor: '100%'
		},{
			xtype: 'textfield',
			name: 'zhuangtai',
			id  : 'zhuangtai',
			value: '正常',
			fieldLabel: '状态',
			readOnly : true,
			style:'color:blue;',
			anchor: '100%'
		},{
			xtype: 'textfield',
			name: 'type',
			id  : 'type',
			value: '碾磨',
			fieldLabel: '产线类型',
			readOnly : true,
			style:'color:blue;',
			anchor: '100%'
		},{
			xtype: 'textfield',
			name: 'jihua',
			id  : 'jihua',
			value: '100',
			fieldLabel: '总计划数',
			anchor: '100%'
		},{
			xtype: 'textfield',
			name: 'dangqian',
			id  : 'dangqian',
			value: '30',
			fieldLabel: '当前计划数',
			anchor: '100%'
		},{
			xtype: 'textfield',
			name: 'jiezou1',
			id  : 'jiezou1',
			value: '1',
			fieldLabel: '节奏1',
			anchor: '100%'
		},{
			xtype: 'textfield',
			name: 'jiezou2',
			id  : 'jiezou2',
			value: '3',
			fieldLabel: '节奏2',
			readOnly : true,
			style:'color:blue;',
			anchor: '100%'
		},{
			xtype: 'textfield',
			name: 'wancheng',
			id  : 'wancheng',
			value: '28',
			fieldLabel: '完成数',
			readOnly : true,
			style:'color:blue;',
			anchor: '100%'
		},{
			xtype: 'textfield',
			name: 'kedonglv1',
			id  : 'kedonglv1',
			value: '20',
			fieldLabel: '可动率1',
			anchor: '100%'
		},{
			xtype: 'textfield',
			name: 'kedonglv2',
			id  : 'kedonglv2',
			value: '19',
			fieldLabel: '可动率2',
			readOnly : true,
			style:'color:blue;',
			anchor: '100%'
		}

		]
	};


	
	var managerWindows = new Ext.Window({
				layout : 'border',
				width : 400,
				height : 450,
				title : "设置",
				modal : true,
				resizable : true,
				maximizable : true,
				iconCls : 'server',
				items : manager_north,
				plain : true
			});
	managerWindows.addButton({
				text : "确定",
				handler : function() {
				
					managerWindows.close();
				}
			});
	managerWindows.addButton({
				text : '取 消',
				handler : function() {
					managerWindows.close();
				}
			});
	managerWindows.show();


}
	